<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../layuiAdmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../src/all.css" media="all">

  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style>
    .margin-top {
      margin-top: 20px;
    }

    .h1 {
      font-size: 20px;
      /* padding-left: 50px; */
    }

    .layui-form-label {
      white-space: nowrap;
    }

    .height {
      height: 20px;
    }
  </style>
</head>


<body style="background-color: #fff;">

  <div class="layui-fluid">
    <div class="layui-card margin-top">
      <!-- layui-card-body -->
      <div class="">
        <form class="layui-form" action="">
          <!-- 行 -->
          <div class="layui-form-item">
            <div class="layui-inline">
              <label for="" class="layui-form-label">专业</label>
              <div class="layui-input-block">
                <select name="modules" lay-verify="required">
                  <option value="">请选择</option>
                  <option value="1">地测</option>
                  <option value="1">冲击地压</option>
                </select>
              </div>
            </div>
            <div class="layui-inline">
              <label for="" class="layui-form-label">危害因素等级</label>
              <div class="layui-input-block">
                <select name="modules" lay-verify="required">
                  <option value="">请选择</option>
                  <option value="1">地测</option>
                  <option value="1">冲击地压</option>
                </select>
              </div>
            </div>
          </div>

        </form>
      </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
  </div>

  <script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container cl">
    <button class="layui-btn layui-btn-sm layui-top-info" lay-event="look"><i class='layui-icon'>&#xe615;</i>查看</button>
    <button class="layui-btn layui-btn-sm layui-top-success" lay-event="chakan"> <i class='layui-icon'>&#xe6b2;</i>审批</button>
    <button class="layui-btn layui-btn-sm layui-top-success" lay-event="dttz"><i class='layui-icon'>&#xe6b2;</i>批量审批</button>
    <button class="layui-btn layui-btn-sm layui-top-warm" lay-event="dttz"><i class='layui-icon'>&#xe624;</i>管理员编辑</button>

    <!--  <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> -->
    <button class="cl-query   layui-btn-sm  " lay-event="a">
      <span class="" >草稿</span>
    </button>
    <button class="cl-query  layui-btn-sm " lay-event="b">
      <span class="" >已上报</span>
    </button>
    <button class="cl-query  layui-btn-sm " lay-event="c">
      <span class="" >已退回</span>
    </button>

    
    <!-- <button class="cl-query  layui-btn-sm " lay-event="d">
      <span class="" >低风险</span>
    </button> -->
    <div class="layui-inline ">
      <label for="" class="layui-form-label">状态</label>
      <div class="layui-input-inline cl-select">
        <select  name="interest" lay-filter="aihao">
          <option value=""></option>
          <option value="0">以上报</option>
          <option value="2"  selected="">未上报</option>
          <option value="2"  selected="">拟上报</option>
        </select>
      </div>
    </div>
    <div class="layui-inline cl-select">
      <input type="text" style='width:200px;' class="layui-input" placeholder="请输入关键字">
    </div>
    <button class="layui-btn layui-btn-normal  layui-btn-sm  " lay-event="select"> 搜索 </button>
    <button  class="layui-btn layui-btn-primary layui-btn-sm"  >
      刷新
    </button>
  </div>
</script>
  <!-- 查看 -->
  <script type="text/html" id="look">
    <form id="dictDataEditForm" lay-filter="dictDataEditForm" class="layui-form model-form" style="padding-left: 10px;">
      <input name="dictDataId" type="hidden"/>
      <div class="layui-form-item">
          <label class="layui-form-label layui-form-required" style="padding-left: 0;width: 95px;">风险类型:</label>
          <div class="layui-input-block">
              <input name="dictDataName" placeholder="请输入字典项名称" class="layui-input"
                      lay-verType="tips" lay-verify="required" required/>
          </div>
      </div>
      <div class="layui-form-item">
          <label class="layui-form-label layui-form-required" style="padding-left: 0;width: 95px;">专业:</label>
          <div class="layui-input-block">
              <input name="dictDataCode" placeholder="请输入字典键值" class="layui-input"
                      lay-verType="tips" lay-verify="required" required/>
          </div>
      </div>
      <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">设备:</label>
          <div class="layui-input-block">
              <input name="sortNumber" placeholder="请输入排序号" class="layui-input" type="number"
                      lay-verType="tips" lay-verify="required" required/>
          </div>
      </div>
      <div class="layui-form-item">
          <label class="layui-form-label">备注:</label>
          <div class="layui-input-block">
              <textarea name="comments" placeholder="请输入备注" class="layui-textarea"></textarea>
          </div>
      </div>
    </form>
  </script>
  <script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">下载</a>
    <a class="layui-btn layui-btn-xs" lay-event="del">预览</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  </script>

  <script src="../../layuiAdmin/layui/layui.all.js" charset="utf-8"></script>
  <!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->

  <script>
    layui.use(['form', 'layedit', 'laydate', 'table'], function () {
      var table = layui.table
        , form = layui.form
        , layer = layui.layer
        , $ = layui.jquery
        , layedit = layui.layedit
        , laydate = layui.laydate;
      //日期
      laydate.render({
        elem: '#date'
      });
      laydate.render({
        elem: '#date1'
      });
      laydate.render({
        elem: '#date2'
      });
      table.render({
        elem: '#test'
        , url: '/js/table.json'
        , toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
        , defaultToolbar: ['']
        , title: '用户数据表'
        , cols: [[
          { type: 'checkbox', fixed: 'left' }
          , { field: 'id', title: 'ID', width: 80, fixed: 'left', unresize: true, sort: true, hide: true }
          , { field: 'fx', title: '风险类型  ', fixed: 'left', unresize: true, sort: true }
          , { field: 'gw', title: '专业  ', edit: 'text' }
          , {
            field: 'point', title: '设备', edit: 'text'
          }
          , { field: 'bumen', title: '作业活动 ', edit: 'text', align: 'center', }
          , { field: 'jc', title: '危害因素等级  ', align: 'center', }
          , { field: 'gw', title: '岗位 ', }
          , { field: 'content', title: '危害因素 ', edit: 'text', sort: true }
          , { field: 'news', title: '管控措施  ', edit: 'text', sort: true }
          , { field: '', title: '管控标准来源  ', edit: 'text', sort: true }
          , { field: '', title: '章节条款   ', edit: 'text', sort: true }
          , { field: '', title: '信息来源    ', edit: 'text', sort: true }

        ]]
        , page: true
      });

      //头工具栏事件
      table.on('toolbar(test)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch (obj.event) {
          case 'look':
            layer.open({
              type: 1,
              title: '未关联危害因素列表',
              area: ['40%', '50%'],
              btn: ['取消'],
              content: $('#look').html(),
              success: function () {

              }
            })
            break;
          case 'exportFile':
            table.exportFile('test', checkStatus.data, 'xls'); //data 为该实例中的任意数量的数据
            break;

        };
      });

      //监听行工具事件
      table.on('tool(test)', function (obj) {
        var data = obj.data;
        //console.log(obj)
        if (obj.event === 'del') {
          layer.confirm('真的删除行么', function (index) {
            obj.del();
            layer.close(index);
          });
        } else if (obj.event === 'edit') {
          layer.prompt({
            formType: 2
            , value: data.email
          }, function (value, index) {
            obj.update({
              email: value
            });
            layer.close(index);
          });
        }
      });
    });
  </script>

</body>

</html>